<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once './application/views/sys_admin/common/system_left.php';  ?>
	
	<!-- Admin_Left End -->
	<div class="admin_right">
		<div class="admin_right_title">
			<strong>支付接口管理</strong> >> 第三方支付登录接口
		</div>
		<div class="admin_right_con" style="width: 98%;">
			<div class="payonline_tab">
				<span data="pay_1" class="active">QQ登录</span>
				<span data="pay_2">新浪微博</span>
			</div>
			
			<div class="payonline_form">
			
				<div id="pay_1">
					<form id="qqloginonlineForm" name="qqloginonlineForm" enctype="multipart/form-data">
						<input type="hidden" value="<?php echo intval($qq['id']);?>" id="qq_id" name="qq_id"/>
						
						<dl class="online_dl">
							<dt>APP_ID：</dt>
							<dd><input type="text" name="is_qq_id" id="is_qq_id" value="<?php echo $qq['username'];?>" class="input" /></dd></dl>
						<dl class="online_dl">
							<dt>APP_KEY：</dt>
							<dd><input name="is_qq_key" id="is_qq_key" size="60" class="input" type="text" value="<?php echo $qq['pwd'];?>" /></dd>
						</dl>
						<dl class="online_dl">
							<dt>APP_CALLBACK_URL</dt>
							<dd><input name="is_qq_callback" id="is_qq_callback" size="60" class="input" type="text" value="<?php echo $qq['smtp_host'];?>" /><span id="" class="tip">QQ登录成功后跳转的地址,请确保地址真实可用，否则会导致登录失败。</span></dd>
						</dl>
						<div class="payment_btm">
						 	 <input type="button" class="btn_b" value="确定"  onclick="qqSubmit()" />
						</div>
					</form>
				</div>
				<div id="pay_2" style="display:none">
					<form id="sinaloginonlineForm" name="sinaloginonlineForm" enctype="multipart/form-data">
						<input type="hidden" value="<?php echo intval($sina['id']);?>" id="sina_id" name="sina_id"/>
							
							<dl class="online_dl">
								<dt>WB_AKEY：</dt>
								<dd><input type="text" name="is_wb_id" id="is_wb_id" value="<?php echo $sina['pwd'];?>" class="input"/></dd>
							</dl>
							<dl class="online_dl">
								<dt>WB_SKEY：</dt>
								<dd><input type="text" name="is_wb_key" id="is_wb_key" size="60" value="<?php echo $sina['pwd'];?>" class="input"/></dd>
							</dl>
							<dl class="online_dl">
								<dt>WB_CALLBACK_URL</dt>
								<dd><input name="is_sina_callback" id="is_sina_callback" size="60" class="input" type="text" value="<?php echo $sina['smtp_host'];?>" /><span id="" class="tip">新浪登录成功后跳转的地址,请确保地址真实可用，否则会导致登录失败。</span></dd>
							</dl>
							<div class="payment_btm">
							 	 <input type="button" class="btn_b" value="确定"  onclick="sinaSubmit()" />
							</div>
					</form>
				</div>	
		</div>
		</div>
		
	</div>	
<!-- Admin_Right End -->
</div>
<div id="dialog" title="系统提示" style="display:none;">
	<div id="msg" style="text-align:center;color:red">&nbsp;</div>
</div>
<script>
$(".payonline_tab span").bind("click", function(){
		var tab = $(".payonline_tab span");
		$.each(tab, function(i,n){
			var tid = $(n).attr('data');
			$(n).removeClass('active');
			$("#"+tid).hide();
		});
		var current = $(this).attr('data');
		$(this).addClass('active');
		$("#"+current).show();
}); 

function sinaSubmit(){
	
	//var t_sina_open = $('input:radio[name="is_open_sina"]:checked').val();

	var t_sina_username = $('#is_wb_id').val();
	var t_sina_pswd = $('#is_wb_key').val();
	var t_sina_id = $('#sina_id').val();
	var t_sina_callback = $('#is_sina_callback').val();
	
	$.ajax({
			type: "POST",
			url: "/sys_admin/payment/savemsgonline",
			data: "msg_username="+t_sina_username+"&msg_pswd="+t_sina_pswd+"&type=4"+"&msg_id="+t_sina_id+"&msg_smtp_host="+t_sina_callback,
			success: function(ret){
				$("#dialog" ).dialog();
				$("#msg").html(ret.msg);
				setTimeout(function(){
					$("#dialog" ).dialog("close");
				},3000);
			},
			dataType: "json"
		});
	
}

function qqSubmit(){
	
	//var t_qq_open = $('input:radio[name="is_open_qq"]:checked').val();
	var t_qq_username = $('#is_qq_id').val();
	var t_qq_pswd = $('#is_qq_key').val();
	var t_qq_id = $('#qq_id').val();
	var t_qq_callback = $('#is_qq_callback').val();
	
	$.ajax({
			type: "POST",
			url: "/sys_admin/payment/savemsgonline",
			data: "msg_username="+t_qq_username+"&msg_pswd="+t_qq_pswd+"&type=3"+"&msg_id="+t_qq_id+"&msg_smtp_host="+t_qq_callback,
			success: function(ret){
				$("#dialog" ).dialog();
				$("#msg").html(ret.msg);
				setTimeout(function(){
					$("#dialog" ).dialog("close");
				},3000);
			},
			dataType: "json"
		});
	
}

</script>
<!-- admin_main end -->
</body>
</html>
